<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<script src="https://cdn.staticfile.org/vue/2.4.2/vue.min.js"></script>
	</head>
	<body>
		<div id="app2">
			千米<input type="text" v-model="a">
			米<input type="text" v-model="b">
			<p>修改前的值为{{a}}修改后的值为{{b}}</p>
			
		</div>
		<script type="text/javascript">
			new Vue({
				el:'#app2',
				data:{
					a:'0',
					b:'0'n
				},
				 watch : {
		        	a:function(val){
		        		if(val=='1'){
		 				alert('00000')
		 			};
		        		this.a=val;
		        		this.b = this.a * 1000
		        		
		        	},
		        	b:function(val){
		        		this.b=val;
		        		this.a = this.b /1000
		        		
		        	},
					}
				
			})
			
		</script>
	</body>
</html>
